<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <p>需要：当前秒数如果被2整除，就成功；否则失败</p>
    <script>
        let time1 = () => {
            return new Promise((resolve, reject) => {
                let t = new Date();
                let s = t.getSeconds();
                if (s % 2) {
                    let arr1 = [
                        '单身情歌', '不要再来伤害我', '燕子之歌'
                    ]
                    reject(arr1)
                } else {
                    resolve(['好运来', '在希望的田野上', '今天你要嫁给我'])
                }
            })
        }

        time1().then(succ => {
            console.log(succ);
        }, fail => {
            console.log(fail);
        }) 
    </script>
</body>

</html>